package com.example.lib_audio.service

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.example.lib_audio.audio.AudioController

class MusicNotificationReceiver: BroadcastReceiver() {
    override fun onReceive(context: Context?, intent: Intent?) {
        val action = intent!!.getStringExtra(MyNotification.BROADCAST_EXTRA_KEY)
        when(action){
            MyNotification.ACTION_PLAY_PAUSE ->{ AudioController.getInstance()?.playOrPause()}
            MyNotification.ACTION_NEXT ->{AudioController.getInstance()?.nextSong()}
            MyNotification.ACTION_PREVIOUS ->{AudioController.getInstance()?.previousSong()}
        }
    }
}